<?php

use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

class CreateProjectsTable extends Migration {

	/**
	 * Run the migrations.
	 *
	 * @return void
	 */
	public function up()
	{
		Schema::create('projects', function(Blueprint $table)
		{
            $table->increments('id');
            $table->string('name');
            $table->integer('leader_id')->unsigned()->index();
            $table->foreign('leader_id')->references('id')->on('users')->onDelete('cascade');

            $table->string('joiner_ids');
            $table->date('start_date');
            $table->date('end_date')->nullable();
            $table->string('progress');
            $table->boolean('completed')->nullable()->default(false);
            $table->timestamps();
		});
	}

	/**
	 * Reverse the migrations.
	 *
	 * @return void
	 */
	public function down()
	{
		Schema::drop('projects');
	}

}
